<template>
  <view>

    <view class="fixed-bottom">
      <u-button @click="scanCode">扫码上料</u-button>
    </view>
  </view>
</template>

<script>

import {dealBarCde} from "@/utils/scanUtil";

export default {
  beforeDestroy() {

  },
  created() {

  },
  data() {
    return {
      form: {
        invCode: null,
        batchNo: null,
      }
    };
  },
  methods: {
    scanCode() {
      uni.scanCode({
        success: (res) => {
          let result = dealBarCde(res.result);
          if (result.sucFlag) {
            this.form.invCode = result.invCode;
            this.form.batchNo = result.batchNo;
          }
        },
        fail: (err) => {
          this.$modal.showToast('扫码失败', err)
        }
      });
    },
  },
}
</script>
<style>
.fixed-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* 可能需要设置一些内边距或外边距以保持良好的视觉效果 */
  padding: 10px;
  text-align: center;
  background-color: #fff; /* 背景色与页面背景色相同或透明，视设计而定 */
  z-index: 999; /* 确保按钮在最上层 */
}
</style>

